package workers;

import domain.ConcurrentContainerInterface;

/**
 * @author igordv
 *
 */
public abstract class AbstractWorker implements Runnable {
	
	protected ConcurrentContainerInterface<Integer> m_container;
	protected int m_delayTimeInMillis;
	/**
	 * 
	 */
	@SuppressWarnings("unused")
	private AbstractWorker() {}
	
	/**
	 * 
	 * @param stack
	 */
	public AbstractWorker(ConcurrentContainerInterface<Integer> container){
		m_container = container;
		m_delayTimeInMillis = 0;
	}
	
	public AbstractWorker(ConcurrentContainerInterface<Integer> container, int delayTimeInMillis){
		m_container = container;
		m_delayTimeInMillis = delayTimeInMillis;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	public void run(){
		System.out.println(description()+" starts");
		threadLogic();
		System.out.println(description()+" finish");
	}
	
	public abstract void threadLogic();
	
	public abstract String description();

}
